// pages/myotw/myotw.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    titleBarHeight: "",
    list: [],
    num: 0,
    leth: 30,
    more: true
  },
  back() {
    wx.navigateBack({
      delta: 1
    })
  },
  deri(e) {
    wx.navigateTo({
      url: '/pages/works/index?id=' + e.currentTarget.dataset.id.otw.wineid + "&type=1",
    })

  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that = this;
    wx.getSystemInfo({
      success: function (res) {
        console.log(res, 'hahahahahhaha')
        that.setData({
          titleBarHeight: res.statusBarHeight + 46
        })
      }
    })
    this.lists()
  },
  lists() {
    let that = this
    app.request({
      url: '/selectOtwItem',
      data: {
        'offset': this.data.num,
        'num': this.data.leth,
      },
      method: "post",
      success: function (res) {
        that.data.list.push(res.data.records)
        that.setData({
          list: that.data.list,
          num: res.data.offset,
          more: res.data.more
        })
        console.log(that.data.list)

      }
    });
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    if (this.data.more == true) {
      this.setData({
        num: this.data.num,
        leth: this.data.leth
      })
      this.lists()
    }

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})